<template>
	<view class="content">
		<view class="navbar">
			<view 
				v-for="(item, index) in navList" :key="index" 
				class="nav-item" 
				:class="{current: tabCurrentIndex === index}"
				@click="tabClick(index)"
			>
				{{item.text}}
			</view>
		</view>

		<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
			<swiper-item class="tab-content" v-for="(tabItem,tabIndex) in navList" :key="tabIndex">
				<scroll-view 
					class="list-scroll-content"
					scroll-y
					@scrolltolower="_getOrderListOnce(tabIndex)"
				>
					<!-- 空白页 -->
					<empty v-if="tabItem.orderList.length === 0"></empty>
					
					<!-- 订单列表 -->
					<view 
						v-for="(item,index) in tabItem.orderList" :key="index"
						class="order-item"
					>
						<view class="i-top">
							<text class="time" style="font-size: 26rpx;">订单号 {{ item.ordersn }}</text>
							<text class="state" style="color: #fe8802;font-size: 26rpx;">{{ item.status_text }}</text>
							<!-- <text class="state" :style="{color: item.stateTipColor}" style="color: #fe8802;">{{item.stateTip}}</text> -->
							<!-- <text 
								v-if="item.state===9" 
								class="del-btn yticon icon-iconfontshanchu1"
								@click="deleteOrder(index)"
							></text> -->
						</view>
						<view style="border-bottom: 0.5px solid #f5f5f5;width: 624rpx;"></view>
						<view style="display: flex;align-items: center;margin-top: 16rpx;">
							<image src="/static/dingwei.png" mode="" style="width: 20rpx;height: 24rpx;"></image>
							<text style="color: #032545;font-size: 24rpx;padding-left: 8rpx;">{{ item.merch_name }}</text>
						</view>
						
						
						<view @click="lookDetail(item)" style="display: flex;margin-top: 20rpx;">
							<view>
								<image class="goods-img" :src="item.banner" mode="aspectFill" style="width: 200rpx;height: 150rpx;border-radius: 12rpx;"></image>
							</view>
							<view class="right" style="margin-left: 20rpx;padding-right: 30rpx;display: flex;height: 150rpx;flex-direction: column;justify-content: space-around;">
								<text class="title" style="font-size: 28rpx;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;text-overflow: ellipsis;">{{ item.title }}</text>
								<view style="display: flex;align-items: center;margin-top: 26rpx;">
									<text class="price" style="display: flex;flex: 1;color: #fe8700;font-size: 32rpx;width: 384rpx;">¥{{ item.price }}</text>
									<text class="attr-box" style="font-size: 22rpx;color: #666;">{{ item.option_title}}</text>
								</view>
							</view>
						</view>
						
						
						<!-- <scroll-view v-if="item.goodsList.length > 1" class="goods-box" scroll-x>
							<view
								v-for="(goodsItem, goodsIndex) in item.goodsList" :key="goodsIndex"
								class="goods-item"
							>
								<image class="goods-img" :src="goodsItem.image" mode="aspectFill"></image>
							</view>
						</scroll-view> -->
						
						<!-- 
						<view 
							v-if="item.goodsList.length === 1" 
							class="goods-box-single"
							v-for="(goodsItem, goodsIndex) in item.goodsList" :key="goodsIndex"
							@click="lookDetail"
						>
							<image class="goods-img" :src="goodsItem.image" mode="aspectFill"></image>
							<view class="right">
								<text class="title">{{goodsItem.title}}</text>
								<view style="display: flex;align-items: center;margin-top: 50rpx;">
									<text class="price" style="display: flex;flex: 1;color: #fe8700;">{{goodsItem.price}}</text>
									<text class="attr-box">{{goodsItem.attr}}  x {{goodsItem.number}}</text>
								</view>
							</view>
						</view> -->
						
						<!-- <view class="price-box">
							共
							<text class="num">7</text>
							件商品 实付款
							<text class="price">143.7</text>
						</view> -->
						<!-- <view class="action-box b-t" v-if="item.state != 9">
							<button class="action-btn recom" @click='payNow'>我要使用</button>
							<button class="action-btn" @click="cancelOrder(item)">取消订单</button>
							<button class="action-btn recom" @click='payNow'>立即付款</button>
						</view> -->
						<view style="border-bottom: 0.5px solid #f5f5f5;width: 624rpx;margin-top: 26rpx;"></view>
						<view class="action-box" style="margin-top: 6rpx;">
							<button class="action-btn" v-show="item.order_is_delete" @click="userDeleteOrder(item)">删除订单</button>
							<button class="action-btn" v-show="item.status === 0" @click="cancelOrder(item)">取消订单</button>
							<button class="action-btn recom" v-show="item.status === 0" @click='payNow(item)'>立即付款</button>
							<button class="action-btn recom" v-show="item.status === 2" @click='application(item)'>我要使用</button>
						</view>
					</view>
					 
					<!-- <uni-load-more :status="tabItem.loadingType"></uni-load-more> -->
					<uni-load-more :loadingType="navList[0].loadingType" :contentText="contentText"></uni-load-more>
					
				</scroll-view>
			</swiper-item>
		</swiper>
		<view class="mask" v-show="isShowMask"></view>
		<!-- 支付选择窗口 -->
		<view class="pay-select" v-if="isPayShow">
			<view class="way">
				<view>请选择支付方式</view>
				<text class="close" @click="closePay">×</text>
			</view>
			<view class="time">请在{{ moneyObj.order_close_time }}分内完成支付  金额 <text>¥{{ moneyObj.price }}</text>元</view>
			<view class="select">
				<view class="wei-xin" v-for="(item, index) in payWay" :key="index" @click="selectPay(index)">
					<image :src="item.url" mode="" class="wei"></image>
					<text class="balance">
						<text>{{ item.val }}</text>
						<text v-show="item.val === '余额'">（¥{{ moneyObj.balance }}）</text>
					</text>
					<image class="is-right" :src="item.sel" mode="" :class="{selected: currentIndex == index}"></image>
				</view>
				<!-- <view class="wei-xin">
					<image src="/static/pay/zhi_fu_bao.jpg" mode="" class="wei"></image>
					<text>支付宝支付</text>
					<image src="/static/pay/pay_selected.jpg" mode="" class="selected"></image>
				</view>
				<view class="wei-xin">
					<image src="/static/pay/balance.jpg" mode="" class="wei"></image>
					<text>余额（¥{{ moneyObj.balance}}）</text>
					<image src="/static/pay/pay_selected.jpg" mode="" class="selected"></image>
				</view> -->
				<button class="button-pay" @click='payMent'>确认支付</button>
			</view>
		</view>
	</view>
</template> 

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	import empty from "@/components/empty";
	import Json from '@/Json';
	// import { tagIndex,tagComp,tagPage,tagData,getOrderList} from '../../api/global.js'
	import { closeOrder, payMoney, cashierOrder, deleteOrder, getWxConfig } from '../../api'
	import wx from '../jweixin/index.js'
	
	// let pageAll = 1;
	// let pageWait = 1;
	let timerAll = null;
	let that;
	// let oddWaitArr = []
	// let waitArr = []
	
	let tagIndex = 0; //0 , 1 , 2, 3 订单页面切换的索引
	// 订单页面 全部，待付款，待核销，已完成 保存的数据
	let tagComp = [[],[],[],[]];
	let tagPage = [1,1,1,1]
	let tagData = ['',0,2,3]
	// 我的订单列表
	function getOrderList(tagIndex, successFunc, failFunc) {
		const url = `/activity/order/list`
		var data = {p:tagPage[tagIndex], length: 10}
		if (tagIndex != 0) {
			data = {p:tagPage[tagIndex], length: 10, status: tagData[tagIndex]}
		}
		uni.request({
		    url: url, //仅为示例，并非真实接口地址。
			method: 'GET',
		    data: data,
		    success: (res) => {
		        successFunc(res.data)
		    },
			fail: (err) => {
				failFunc(err)
			}
		})
	}
	
	export default {
		components: {
			uniLoadMore,
			empty
		},
		data() {
			return {
				isShowMask: false, // 遮罩默认不显示
				isPayShow: false,
				moneyObj: {}, // 点击我要报名出现的余额
				is_refund: '', // 是否支持退款
				payWay: [
					{
						url: '/static/pay/wei_xin.jpg',
						val: '微信支付',
						sel: '/static/pay/pay_selected.jpg'
					},
					// {
					// 	url: '/static/zhi_fu_bao.jpg',
					// 	val: '支付宝支付',
					// 	sel: '/static/pay/pay_selected.jpg'
					// },
					{
						url: '/static/pay/balance.jpg',
						val: '余额',
						sel: '/static/pay/pay_selected.jpg'
					}
				],
				// loadingType: 0,//定义加载方式 0---contentdown  1---contentrefresh 2---contentnomore
				contentText: {
					contentdown:'上拉显示更多',
					contentrefresh: '正在加载...',
					contentnomore: '没有更多数据了'
				},
				tabCurrentIndex: 0,
				currentIndex: 0, // 默认选中微信支付
				navList: [{
						state: 0,
						text: '全部',
						loadingType: 0, //定义加载方式 0---contentdown  1---contentrefresh 2---contentnomore
						// loadingType: 'more',
						orderList: []
					},
					{
						state: 1,
						text: '待付款',
						loadingType: 0,
						orderList: []
					},
					{
						state: 2,
						text: '待核销',
						loadingType: 0,
						orderList: []
					},
					{
						state: 3,
						text: '已完成',
						loadingType: 0,
						orderList: []
					},
					// {
					// 	state: 4,
					// 	text: '售后',
					// 	loadingType: 'more',
					// 	orderList: []
					// }
				],
			};
		},
		
		onLoad(options){
			that = this;
			/**
			 * 修复app端点击除全部订单外的按钮进入时不加载数据的问题
			 * 替换onLoad下代码即可
			 */
			// this.tabCurrentIndex = +options.state;
			// // #ifndef MP
			// this.loadData()
			// // #endif
			// // #ifdef MP
			// if(options.state == 0){
			// 	this.loadData()
			// }
			// // #endif
			
			// start
			// #ifdef H5
			if(options.state == 0){
				tagIndex = 0
				tagPage.forEach((item) => {
					item = 1
				})
				that.getOrderListOnce()
			} else if (options.state == 1) {
				tagIndex = 1
				that.getOrderListOnce()
			} else if (options.state == 2) {
				tagIndex = 2
				that.getOrderListOnce()
			} else if (options.state == 3) {
				tagIndex = 3
				that.getOrderListOnce()
			} else {
				tagIndex = 0
				tagPage.forEach((item) => {
					item = 1
				})
				that.getOrderListOnce()
			}
			// #endif
		},
		onShow() {
			tagIndex = 0
			tagPage.forEach((item) => {
				item = 1
			})
			console.log(tagIndex)
			console.log(tagPage)
			// that.getOrderListOnce()
		},
		//下拉刷新
		onPullDownRefresh(){
			// this.loadData('refresh');
			// this.navList[tagIndex].orderList = []
			// this.getOrderListOnce() // 加载活动列表数据
			tagPage[tagIndex] = 1
			this.navList[tagIndex].orderList = []
			this._getOrderListOnce(tagIndex)
		},
		//加载更多
		onReachBottom(){
			// this.loadData();
			if (timerAll != null) {
				clearTimeout(timerAll);
			}
			
			timerAll = setTimeout(function() {
				that._getOrderListOnce(tagIndex);
			}, 200);
			
			// this._getOrderListOnce() // 加载活动列表数据
		}, 
		methods: {
			// 我要使用
			application(item) {
				console.log(item)
				uni.navigateTo({
					url: '/pages/active/payOrderDetail?id=' + item.id
				})
			},
			// 用户删除订单
			userDeleteOrder(item) {
				console.log(item)
				let data = {id: item.id}
				uni.showModal({
				    title: '提示',
				    content: '确认删除吗',
				    success: function (res) {
				        if (res.confirm) {
				            console.log('用户点击确定');
							deleteOrder(data, (res) => {
								uni.showToast({
								    title: '删除成功',
								    duration: 1000
								});
								that.navList[tagIndex].orderList = that.navList[tagIndex].orderList.filter(order => order.id !== item.id)
							})
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				        }
				    }
				})
			},
			// 立即付款
			payNow(item) {
				console.log(item)
				this.is_refund = item.is_refund
				// this.moneyObj = item
				let data = {id: item.id}
				cashierOrder(data, (res) => {
					console.log(res)
					this.moneyObj = res.data
					this.isShowMask = true
					this.isPayShow = true
				})
			},
			// 确认支付
			payMent() {
				console.log(this.currentIndex)
				uni.showLoading({
				    title: '支付中...'
				})
				// 判断活动金额是否等于0，真的话直接跳转订单详情页面
				let b = this.moneyObj.price - 0
				if (b <= 0) {
					
					if (this.currentIndex === 0) {
						// 微信支付
						let data = {id: this.moneyObj.id,paytype: 3}
						payMoney(data, (res) => {
							console.log(res)
							
							setTimeout( ()=> {
							    uni.hideLoading();
								uni.navigateTo({
									url: '/pages/active/payOrderDetail?id=' + res.data.id + '&refundid=' + this.is_refund
								})
							}, 1000)
							return
						})
					} else {
						// 余额支付
						let data = {id: this.moneyObj.id,paytype: 1}
						payMoney(data, (res) => {
							console.log(res)
							if (res.code != 0) {
								uni.showToast({
									title: res.message,
									icon: 'none'
								})
							} else {
								
								setTimeout( ()=> {
								    uni.hideLoading();
									uni.navigateTo({
										url: '/pages/active/payOrderDetail?id=' + res.data.id + '&refundid=' + this.is_refund
									})
								}, 1000)
							}
						})
					}
					
					return
				}
				// this.currentIndex===0 微信支付，1是余额支付
				if (this.currentIndex === 0) {
					// 微信支付
					let data = {id: this.moneyObj.id,paytype: 3}
					payMoney(data, (res) => {
						console.log(res)
						window.location.href = res.data.url
					})
					// uni.showToast({
					//     title: '微信成功支付100万',
					//     duration: 1000
					// });
				} else {
					// 余额支付
					let data = {id: this.moneyObj.id,paytype: 1}
					payMoney(data, (res) => {
						console.log(res)
						if (res.code != 0) {
							uni.showToast({
								title: res.message,
								icon: 'none'
							})
						}  else {
							
							setTimeout( ()=> {
							    uni.hideLoading();
								uni.navigateTo({
									// url: '/pages/active/payOrderDetail?id=' + this.moneyObj.id + '&refundid=' + this.activityObj.is_refund
									url: '/pages/active/payOrderDetail?id=' + res.data.id + '&refundid=' + this.is_refund
								})
							}, 1000)
							
						}
						
					})
					// uni.showToast({
					//     title: '余额成功支付100万',
					//     duration: 1000
					// });
				}
				
			},
			// 关闭支付页面
			closePay() {
				this.isPayShow = false
				this.isShowMask = false
			},
			// 选中支付方式
			selectPay(index) {
				console.log(index)
				
				this.currentIndex = index
			},
			// 第一次加载订单列表(全部的)
			getOrderListOnce() {
				uni.showNavigationBarLoading();
				getOrderList(tagIndex, (res) => {
					if (res.code === 3) {
						uni.showToast({
				　　　　　　 title: res.message,
				　　　　　　 icon: 'none'
				　　　　 })
						let url = encodeURIComponent(`https://mobile.laiba.shop/html/#/pages/order/order?state=0`)
						window.location.href = 'https://mobile.laiba.shop/activity/visitor/auth?url=' + url
					} else {
						this._getWxConfig() // 分享
						console.log(res)
						let data = res.data.order
						that.navList[tagIndex].orderList = [...that.navList[tagIndex].orderList, ...data]
						// if (that.navList[tagIndex].loadingType !== 0) {//loadingType!=0;直接返回
						// 	// let data = res.data.order
						// 	// that.navList[tagIndex].orderList = [...that.navList[tagIndex].orderList, ...data]
						// 	return ;
						// }
						if (res.data.order.length < 10) {
							that.navList[tagIndex].loadingType = -1;//将loadingType 重置
						} else{
							that.navList[tagIndex].loadingType = 0;
							// tagPage[tagIndex]++;
							console.log(res.data.order)
						}
						uni.hideNavigationBarLoading();
						// uni.stopPullDownRefresh();//得到数据后停止下拉刷新
					}
					
				})
				uni.stopPullDownRefresh();//得到数据后停止下拉刷新
				
			},
			// 加载更多(全部的)
			_getOrderListOnce(tabIndexMore) {
				console.log(tabIndexMore)
				var tagIndex = tabIndexMore
				uni.showNavigationBarLoading();
				
				if (that.navList[tagIndex].loadingType !== 0) {//loadingType!=0;直接返回
					return
				}
				
				getOrderList(tagIndex, (res) => {
					console.log(res)
					console.log(res.data.order)
					// that.navList[tagIndex].orderList = that.navList[tagIndex].orderList.concat(res.data.order)
					let data = res.data.order
					that.navList[tagIndex].orderList = [...that.navList[tagIndex].orderList, ...data]
					console.log("1312313213131321312123131")
					console.log(that.navList[tagIndex].loadingType)
					console.log("1312313213131321312123131")
					if (res.data.order.length < 10) {
						that.navList[tagIndex].loadingType = -1;//将loadingType归0重置
					} else{
						that.navList[tagIndex].loadingType = 0;
						tagPage[tagIndex]++;
					}
					uni.hideNavigationBarLoading();
					// uni.stopPullDownRefresh();//得到数据后停止下拉刷新
				})
				uni.stopPullDownRefresh();//得到数据后停止下拉刷新
				
			},
			_getWxConfig() {
				getWxConfig({}, (res) => {
					console.log(res)
					let data = {
						debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
						appId: res.data.appId, // 必填，公众号的唯一标识
						timestamp: res.data.timestamp, // 必填，生成签名的时间戳
						nonceStr: res.data.nonceStr, // 必填，生成签名的随机串
						signature: res.data.signature,// 必填，签名
						// jsApiList: ['updateAppMessageShareData','updateTimelineShareData','downloadImage'] ,// 必填，需要使用的JS接列表
						jsApiList: ['onMenuShareAppMessage','onMenuShareTimeline','downloadImage'] // 必填，需要使用的JS接口列表
					}
					
					wx.config(data)
					wx.ready( () => {
						if (location.href.includes('?from')) {
							let sLink = location.href.split('?')
							window.location.href = 'https://mobile.laiba.shop/html/#/pages/order/order?state=0'
						}
						// this.newUrl = location.href
						wx.onMenuShareAppMessage({ 
						    title: '来爸来妈优选', // 分享标题
						    desc: '点击进入', // 分享描述
						    link: location.href, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
							imgUrl: 'http://oss.laiba.shop/activity/20191216/openproxy.jpeg', // 分享图标
						    success: () => {
						      // 设置成功
							  uni.showToast({
							  	title: '分享成功',
								icon: 'none'
							  })
						    }
						})
						wx.onMenuShareTimeline({
							title: '来爸来妈优选', // 分享标题
							link: location.href, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
							imgUrl: 'http://oss.laiba.shop/activity/20191216/openproxy.jpeg', // 分享图标
							success: () => {
							  // 设置成功
							  uni.showToast({
							  	title: '分享成功',
								icon: 'none'
							  })
							}
						})
					})
				})
			},
			// 查看订单详情
			lookDetail(item) {
				console.log("查看订单详情")
				console.log(item)
				uni.navigateTo({
					url: '/pages/active/payOrderDetail?id=' + item.id
				})
				
			},
			//获取订单列表
			// loadData(source){
			// 	//这里是将订单挂载到tab列表下
			// 	let index = this.tabCurrentIndex;
			// 	let navItem = this.navList[index];
			// 	let state = navItem.state;
				
			// 	if(source === 'tabChange' && navItem.loaded === true){
			// 		//tab切换只有第一次需要加载数据
			// 		return;
			// 	}
			// 	// if(navItem.loadingType === 'loading'){
			// 	// 	//防止重复加载
			// 	// 	return;
			// 	// }
				
			// 	// navItem.loadingType = 'loading';
				
			// 	setTimeout(()=>{
 		// 			let orderList = Json.orderList.filter(item=>{
			// 			//添加不同状态下订单的表现形式
			// 			item = Object.assign(item, this.orderStateExp(item.state));
			// 			//演示数据所以自己进行状态筛选
			// 			if(state === 0){
			// 				//0为全部订单
			// 				return item;
			// 			}
			// 			return item.state === state
			// 		});
			// 		orderList.forEach(item=>{
			// 			navItem.orderList.push(item);
			// 		})
			// 		//loaded新字段用于表示数据加载完毕，如果为空可以显示空白页
			// 		this.$set(navItem, 'loaded', true);
					
			// 		//判断是否还有数据， 有改为 more， 没有改为noMore 
			// 		// navItem.loadingType = 'more';
			// 	}, 600);	
			// }, 

			//swiper 切换
			changeTab(e){
				this.tabCurrentIndex = e.target.current; // 当前状态
				// this.loadData('tabChange');
				console.log(this.tabCurrentIndex)
				tagIndex = this.tabCurrentIndex;
				if(that.navList[tagIndex].orderList.length <=0) {
					that._getOrderListOnce(tagIndex)
				}
				console.log(that.navList[3].orderList)
			},
			//顶部tab点击 切换
			tabClick(index){
				this.tabCurrentIndex = index;
			},
			//删除订单
			deleteOrder(index){
				uni.showLoading({
					title: '请稍后'
				})
				setTimeout(()=>{
					this.navList[this.tabCurrentIndex].orderList.splice(index, 1);
					uni.hideLoading();
				}, 600)
			},
			//取消订单
			cancelOrder(item){
				console.log(item)
				let data = {id: item.id}
				uni.showModal({
				    title: '提示',
				    content: '确认取消吗',
				    success: function (res) {
				        if (res.confirm) {
				            console.log('用户点击确定');
							closeOrder(data, (response) => {
								if (response.code != 0) {
									uni.showToast({
							　　　　　　 title: response.message,
							　　　　　　 icon: 'none'
							　　　　 })
									return
								}
								uni.showToast({
								    title: '取消成功',
								    duration: 1000
								});
								that.navList[tagIndex].orderList = that.navList[tagIndex].orderList.filter(order => order.id !== item.id)
								console.log(response)
							})
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				        }
				    }
				})
				// uni.showLoading({
				// 	title: '请稍后'
				// })
				// setTimeout(()=>{
				// 	let {stateTip, stateTipColor} = this.orderStateExp(9);
				// 	item = Object.assign(item, {
				// 		state: 9,
				// 		stateTip, 
				// 		stateTipColor
				// 	})
					
				// 	//取消订单后删除待付款中该项
				// 	let list = this.navList[1].orderList;
				// 	let index = list.findIndex(val=>val.id === item.id);
				// 	index !== -1 && list.splice(index, 1);
					
				// 	uni.hideLoading();
				// }, 600)
			},

			//订单状态文字和颜色
			orderStateExp(state){
				let stateTip = '',
					stateTipColor = '#fa436a';
				switch(+state){
					case 1:
						stateTip = '待付款'; break;
					case 2:
						stateTip = '待发货'; break;
					case 9:
						stateTip = '订单已关闭'; 
						stateTipColor = '#909399';
						break;
						
					//更多自定义
				}
				return {stateTip, stateTipColor};
			},
			
		},
	}
</script>

<style lang="scss">
	page, .content{
		background: $page-color-base;
		height: 100%;
	}
	.mask {
		position:fixed;
		width:100%;
		height:100%;
		background-color:#000;
		opacity:0.7;
		filter:alpha(opacity=70);
		left:0;
		bottom: 0;
		z-index:10;
	}
	.swiper-box{
		height: calc(100% - 40px);
	}
	.list-scroll-content{
		height: 100%;
	}
	.navbar{
		display: flex;
		height: 40px;
		padding: 0 5px;
		background: #fff;
		box-shadow: 0 1px 5px rgba(0,0,0,.06);
		position: relative;
		z-index: 10;
		.nav-item{
			flex: 1;
			display: flex;
			justify-content: center;
			align-items: center;
			height: 100%;
			font-size: 15px;
			color: $font-color-dark;
			color: #a7a7a7;
			position: relative;
			
			&.current{
				color: #032545;
				&:after{
					content: '';
					position: absolute;
					left: 50%;
					bottom: 10rpx;
					transform: translateX(-50%);
					width: 22px;
					height: 0;
					border-bottom: 2px solid #fe8802;
					border-radius: 3px;
				}
			}
		}
	}

	.uni-swiper-item{
		height: auto;
	}
	.order-item{
		display: flex;
		flex-direction: column;
		padding-left: 30upx;
		// background: #fff;
		margin-top: 16upx;
		width: 678rpx;
		height: 448rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
		margin: 28rpx auto 0;
		.i-top{
			display: flex;
			align-items: center;
			height: 80upx;
			padding-right:30upx;
			font-size: $font-base;
			color: $font-color-dark;
			position: relative;
			// border-bottom: #e6e6e6;
			.time{
				flex: 1;
				color: #999;
			}
			.state{
				color: $base-color;
			}
			.del-btn{
				padding: 10upx 0 10upx 36upx;
				font-size: $font-lg;
				color: $font-color-light;
				position: relative;
				&:after{
					content: '';
					width: 0;
					height: 30upx;
					border-left: 1px solid $border-color-dark;
					position: absolute;
					left: 20upx;
					top: 50%;
					transform: translateY(-50%);
				}
			}
		}
		/* 多条商品 */
		.goods-box{
			height: 160upx;
			padding: 20upx 0;
			white-space: nowrap;
			.goods-item{
				width: 120upx;
				height: 120upx;
				display: inline-block;
				margin-right: 24upx;
			}
			.goods-img{
				display: block;
				width: 100%;
				height: 100%;
				// width: 200rpx;
				// height: 150rpx;
				// border-radius: 12rpx;
				// background-color: #ffb302;
			}
		}
		/* 单条商品 */
		.goods-box-single{
			display: flex;
			padding: 20upx 0;
			.goods-img{
				display: flex;
				// width: 120upx;
				// height: 120upx;
				width: 200rpx;
				height: 150rpx;
				border-radius: 12rpx;
				background-color: #ffb302;
			}
			.right{
				flex: 1;
				display: flex;
				flex-direction: column;
				padding: 0 30upx 0 24upx;
				overflow: hidden;
				.title{
					color: #032545;
					font-family: PingFangSC-Regular;
					line-height: 1;
					width: 407rpx;
					height: 67rpx;
					font-size: 28rpx;
					line-height: 40rpx;
					// 2行，超出之后...
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					overflow: hidden;
					text-overflow: ellipsis;
				}
				.attr-box{
					font-size: $font-sm + 2upx;
					color: $font-color-light;
					color: #666;
					// padding: 10upx 12upx;
				}
				.price{
					font-size: $font-base + 2upx;
					color: $font-color-dark;
					&:before{
						content: '￥';
						font-size: $font-sm;
						margin: 0 2upx 0 8upx;
					}
					
				}
			}
		}
		
		.price-box{
			display: flex;
			justify-content: flex-end;
			align-items: baseline;
			padding: 20upx 30upx;
			font-size: $font-sm + 2upx;
			color: $font-color-light;
			.num{
				margin: 0 8upx;
				color: $font-color-dark;
			}
			.price{
				font-size: $font-lg;
				color: $font-color-dark;
				&:before{
					content: '￥';
					font-size: $font-sm;
					margin: 0 2upx 0 8upx;
				}
			}
		}
		.action-box{
			display: flex;
			justify-content: flex-end;
			align-items: center;
			height: 100upx;
			position: relative;
			padding-right: 30upx;
		}
		.action-btn{
			width: 160upx;
			height: 60upx;
			margin: 0;
			margin-left: 24upx;
			padding: 0;
			text-align: center;
			line-height: 60upx;
			font-size: $font-sm + 2upx;
			// color: $font-color-dark;
			color: #999999;
			background: #fff;
			border-radius: 100px;
			border: solid 1rpx #989898;
			&:after{
				border-radius: 100px;
			}
			&.recom{
				background-image: linear-gradient(-90deg,
						#fe8700 0%, 
						#ff9e2c 100%), 
					linear-gradient(
						#e95783, 
						#e95783);
				color: #fff;
				border: none;
				// color: $base-color;
				&:after{
					border-color: #f7bcc8;
				}
			}
		}
	}
	
	
	/* load-more */
	.uni-load-more {
		display: flex;
		flex-direction: row;
		height: 80upx;
		align-items: center;
		justify-content: center
	}
	
	.uni-load-more__text {
		font-size: 28upx;
		color: #999
	}
	
	.uni-load-more__img {
		height: 24px;
		width: 24px;
		margin-right: 10px
	}
	
	.uni-load-more__img>view {
		position: absolute
	}
	
	.uni-load-more__img>view view {
		width: 6px;
		height: 2px;
		border-top-left-radius: 1px;
		border-bottom-left-radius: 1px;
		background: #999;
		position: absolute;
		opacity: .2;
		transform-origin: 50%;
		animation: load 1.56s ease infinite
	}
	
	.uni-load-more__img>view view:nth-child(1) {
		transform: rotate(90deg);
		top: 2px;
		left: 9px
	}
	
	.uni-load-more__img>view view:nth-child(2) {
		transform: rotate(180deg);
		top: 11px;
		right: 0
	}
	
	.uni-load-more__img>view view:nth-child(3) {
		transform: rotate(270deg);
		bottom: 2px;
		left: 9px
	}
	
	.uni-load-more__img>view view:nth-child(4) {
		top: 11px;
		left: 0
	}
	
	.load1,
	.load2,
	.load3 {
		height: 24px;
		width: 24px
	}
	
	.load2 {
		transform: rotate(30deg)
	}
	
	.load3 {
		transform: rotate(60deg)
	}
	
	.load1 view:nth-child(1) {
		animation-delay: 0s
	}
	
	.load2 view:nth-child(1) {
		animation-delay: .13s
	}
	
	.load3 view:nth-child(1) {
		animation-delay: .26s
	}
	
	.load1 view:nth-child(2) {
		animation-delay: .39s
	}
	
	.load2 view:nth-child(2) {
		animation-delay: .52s
	}
	
	.load3 view:nth-child(2) {
		animation-delay: .65s
	}
	
	.load1 view:nth-child(3) {
		animation-delay: .78s
	}
	
	.load2 view:nth-child(3) {
		animation-delay: .91s
	}
	
	.load3 view:nth-child(3) {
		animation-delay: 1.04s
	}
	
	.load1 view:nth-child(4) {
		animation-delay: 1.17s
	}
	
	.load2 view:nth-child(4) {
		animation-delay: 1.3s
	}
	
	.load3 view:nth-child(4) {
		animation-delay: 1.43s
	}
	
	@-webkit-keyframes load {
		0% {
			opacity: 1
		}
	
		100% {
			opacity: .2
		}
	}
	.pay-select {
		width: 750rpx;
		// height: 668rpx;
		background-color: #ffffff;
		// background-color: red;
		border-radius: 10rpx 10rpx 0rpx 0rpx;
		position: absolute;
		left: 0;
		bottom: 0;
		z-index: 11;
		animation: popupSelect 0.2s;
		animation-fill-mode: forwards;
		overflow-x: hidden;
		overflow-y: auto;
		// top: 0;
		.way {
			font-family: SourceHanSansCN-Medium;
			font-size: 36rpx;
			color: #1a1a1a;
			margin-top: 49rpx;
			text-align: center;
			position: relative;
			text {
				font-size: 45rpx;
				position: absolute;
				right: 35rpx;
				top: -5rpx;
			}
		}
		.time {
			font-family: SourceHanSansCN-Regular;
			font-size: 28rpx;
			color: #032545;
			margin-top: 50rpx;
			text-align: center;
			text {
				font-family: PingFangSC-Medium;
				font-size: 28rpx;
				color: #fe8700;
				padding-left: 4rpx;
			}
		}
		.select {
			margin: 25rpx 36rpx 0;
			.wei-xin {
				box-sizing: border-box;
				border-bottom: 1px solid #e6e6e6;
				height: 100rpx;
				display: flex;
				align-items: center;
				.wei {
					width: 46rpx;
					height: 40rpx;
					margin-right: 18rpx;
					margin-left: 13rpx;
				}
				text {
					font-size: 30rpx;
					color: #032545;
					display: flex;
					flex: 1;
				}
				.selected {
					opacity: 1 !important;
				}
				.is-right {
					width: 36rpx;
					height: 36rpx;
					margin-right: 16rpx;
					opacity: 0;
				}
			}
			
			.button-pay {
				width: 678rpx;
				height: 90rpx;
				line-height: 90rpx;
				font-size: 32rpx;
				background-image: linear-gradient(-90deg, 
						#fe8700 0%, 
						#ff9e2c 100%), 
					linear-gradient(-89deg, 
						#e95783 0%, 
						#fe93a3 100%), 
					linear-gradient(
						#cb9e5f, 
						#cb9e5f);
				border-radius: 45rpx;
				position: fixed;
				left: 50%;
				bottom: 21rpx;
				margin-left: -339rpx;
				color: #fff;
				letter-spacing: 2rpx;
			}
			uni-button:after {
			    border: none;
			}
		}
	}
	@keyframes popupSelect
	{
		0%   {height: 0;}
		/*50%  {height:40%;}*/
		100% {height: 668rpx;}
	}
</style>
